#ifndef     __PROGRESS_H
#define     __PROGRESS_H

#include "../rtx/rtx_os.h"

namespace utils {

struct Progress {
public:
    inline Progress() : m_tick(osKernelGetTickCount()) {
    }

    void reset() {
        m_tick = osKernelGetTickCount();
    }

    bool is_after(uint32_t timeout) const {
        return osKernelGetTickCount() > (m_tick + timeout);
    }

    uint32_t duration() const {
        return osKernelGetTickCount() - m_tick;
    }

private:
    uint32_t m_tick;
};

}

#endif
